﻿public class Program
{
    public static async Task Main()
    {
        string twoFactorSecret = File.ReadAllText("key.txt").Replace(" ","").Trim();
        var client = new GitLab2FAClient(twoFactorSecret);

        Console.WriteLine("正在生成 GitLab 双重身份验证码...");

        // 持续显示当前验证码及其剩余有效期
        while (true)
        {
            var (code, timeRemaining) = client.GenerateTOTPCodeWithExpiry();

            Console.Clear();
            Console.WriteLine($"当前验证码: {code}");
            Console.WriteLine($"有效期剩余: {timeRemaining} 秒");
            Console.WriteLine("按 Ctrl+C 退出");

            // 每秒更新一次显示
            await Task.Delay(1000);
        }
    }
}